#include <iostream>
#include <gtest/gtest.h>
#include <unordered_map>

class MyTest : public testing::Test
{
public:
    static void SetUpTestCase()
    {
        std::cout << "单元测试执行前的总环境初始化！\n";
    }
    virtual void SetUp() override
    {
        std::cout << "单元测试初始化！\n";
        _mymap.insert(std::make_pair("hello", "你好"));
        _mymap.insert(std::make_pair("byebye", "再见"));
    }
    virtual void TearDown() override
    {
        _mymap.clear();
        std::cout << "单元测试清理！\n";
    }
    static void TearDownTestCase()
    {
        std::cout << "单元测试执行完毕后的总环境清理！\n";
    }
public:
    std::unordered_map<std::string, std::string> _mymap;
};

TEST_F(MyTest, insert_test)
{
    _mymap.insert(std::make_pair("hi", "你好"));
    ASSERT_EQ(_mymap.size(), 3);
}
TEST_F(MyTest, size_test)
{
    ASSERT_EQ(_mymap.size(), 2);
}

int main(int argc, char* argv[])
{
    testing::InitGoogleTest(&argc, argv);
    RUN_ALL_TESTS();

    return 0;
}